home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickDraw3D 1.6 SDK / Mac Interfaces / CIncludes / QD3DViewer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  15.7 KB  |  527 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DViewer.h
  3.  
  4.      Contains:    MacOS Viewer Controller Interface File.                                
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.6
  7.                  Release:    QuickTime 4.0
  8.  
  9.      Copyright:    © 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3DVIEWER__
  18. #define __QD3DVIEWER__
  19.  
  20. #ifndef __QD3D__
  21. #include <QD3D.h>
  22. #endif
  23. #ifndef __QD3DGROUP__
  24. #include <QD3DGroup.h>
  25. #endif
  26.  
  27. #if TARGET_OS_MAC
  28. #ifndef __EVENTS__
  29. #include <Events.h>
  30. #endif
  31. #ifndef __MACTYPES__
  32. #include <MacTypes.h>
  33. #endif
  34. #ifndef __QUICKDRAW__
  35. #include <Quickdraw.h>
  36. #endif
  37. #endif  /* TARGET_OS_MAC */
  38.  
  39.  
  40.  
  41. #if PRAGMA_ONCE
  42. #pragma once
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. #if PRAGMA_IMPORT
  50. #pragma import on
  51. #endif
  52.  
  53. #if PRAGMA_STRUCT_ALIGN
  54.     #pragma options align=power
  55. #elif PRAGMA_STRUCT_PACKPUSH
  56.     #pragma pack(push, 2)
  57. #elif PRAGMA_STRUCT_PACK
  58.     #pragma pack(2)
  59. #endif
  60.  
  61. #if PRAGMA_ENUM_ALWAYSINT
  62.     #pragma enumsalwaysint on
  63. #elif PRAGMA_ENUM_OPTIONS
  64.     #pragma option enum=int
  65. #elif PRAGMA_ENUM_PACK
  66.     #if __option(pack_enums)
  67.         #define PRAGMA_ENUM_PACK__QD3DVIEWER__
  68.     #endif
  69.     #pragma options(!pack_enums)
  70. #endif
  71.  
  72. typedef void *                            TQ3ViewerObject;
  73.  
  74. typedef CALLBACK_API_C( TQ3Status , TQ3ViewerWindowResizeCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  75. typedef CALLBACK_API_C( TQ3Status , TQ3ViewerPaneResizeNotifyCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  76.  
  77. #if TARGET_OS_MAC
  78. typedef CALLBACK_API_C( OSErr , TQ3ViewerDrawingCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  79.  
  80. enum {
  81.     kQ3ViewerShowBadge            = 1 << 0,
  82.     kQ3ViewerActive                = 1 << 1,
  83.     kQ3ViewerControllerVisible    = 1 << 2,
  84.     kQ3ViewerDrawFrame            = 1 << 3,
  85.     kQ3ViewerDraggingOff        = 1 << 4,
  86.     kQ3ViewerButtonCamera        = 1 << 5,
  87.     kQ3ViewerButtonTruck        = 1 << 6,
  88.     kQ3ViewerButtonOrbit        = 1 << 7,
  89.     kQ3ViewerButtonZoom            = 1 << 8,
  90.     kQ3ViewerButtonDolly        = 1 << 9,
  91.     kQ3ViewerButtonReset        = 1 << 10,
  92.     kQ3ViewerOutputTextMode        = 1 << 11,
  93.     kQ3ViewerDragMode            = 1 << 12,
  94.     kQ3ViewerDrawGrowBox        = 1 << 13,
  95.     kQ3ViewerDrawDragBorder        = 1 << 14,
  96.     kQ3ViewerDraggingInOff        = 1 << 15,
  97.     kQ3ViewerDraggingOutOff        = 1 << 16,
  98.     kQ3ViewerButtonOptions        = 1 << 17,
  99.     kQ3ViewerPaneGrowBox        = 1 << 18,
  100.     kQ3ViewerDefault            = 1 << 31
  101. };
  102.  
  103. enum {
  104.     kQ3ViewerEmpty                = 0,
  105.     kQ3ViewerHasModel            = 1 << 0,
  106.     kQ3ViewerHasUndo            = 1 << 1
  107. };
  108.  
  109.  
  110. enum TQ3ViewerCameraView {
  111.     kQ3ViewerCameraRestore        = 0,
  112.     kQ3ViewerCameraFit            = 1,
  113.     kQ3ViewerCameraFront        = 2,
  114.     kQ3ViewerCameraBack            = 3,
  115.     kQ3ViewerCameraLeft            = 4,
  116.     kQ3ViewerCameraRight        = 5,
  117.     kQ3ViewerCameraTop            = 6,
  118.     kQ3ViewerCameraBottom        = 7
  119. };
  120. typedef enum TQ3ViewerCameraView TQ3ViewerCameraView;
  121.  
  122.  
  123.  
  124.  
  125. /******************************************************************************
  126.  **                                                                             **
  127.  **        Return viewer version number                                         **
  128.  **                                                                             **
  129.  *****************************************************************************/
  130. EXTERN_API_C( OSErr )
  131. Q3ViewerGetVersion                (unsigned long *        majorRevision,
  132.                                  unsigned long *        minorRevision);
  133.  
  134.  
  135. /******************************************************************************
  136.  **                                                                             **
  137.  **        Return viewer release version number                                 **
  138.  **        (in 'vers' format - e.g. 0x01518000 ==> 1.5.1 release)                 **
  139.  **                                                                             **
  140.  *****************************************************************************/
  141. EXTERN_API_C( OSErr )
  142. Q3ViewerGetReleaseVersion        (unsigned long *        releaseRevision);
  143.  
  144.  
  145. /******************************************************************************
  146.  **                                                                             **
  147.  **                        Creation and destruction                             **
  148.  **                Note that this is not a QuickDraw 3D object                     **
  149.  **                                                                             **
  150.  *****************************************************************************/
  151. EXTERN_API_C( TQ3ViewerObject )
  152. Q3ViewerNew                        (CGrafPtr                 port,
  153.                                  Rect *                    rect,
  154.                                  unsigned long             flags);
  155.  
  156. EXTERN_API_C( OSErr )
  157. Q3ViewerDispose                    (TQ3ViewerObject         theViewer);
  158.  
  159.  
  160. /******************************************************************************
  161.  **                                                                             **
  162.  **                    Functions to attach data to a viewer                     **
  163.  **                                                                             **
  164.  *****************************************************************************/
  165. EXTERN_API_C( OSErr )
  166. Q3ViewerUseFile                    (TQ3ViewerObject         theViewer,
  167.                                  long                     refNum);
  168.  
  169. EXTERN_API_C( OSErr )
  170. Q3ViewerUseData                    (TQ3ViewerObject         theViewer,
  171.                                  void *                    data,
  172.                                  long                     size);
  173.  
  174.  
  175. /******************************************************************************
  176.  **                                                                             **
  177.  **        Functions to write data out from the Viewer                             **
  178.  **                                                                             **
  179.  *****************************************************************************/
  180. EXTERN_API_C( OSErr )
  181. Q3ViewerWriteFile                (TQ3ViewerObject         theViewer,
  182.                                  long                     refNum);
  183.  
  184. EXTERN_API_C( unsigned long )
  185. Q3ViewerWriteData                (TQ3ViewerObject         theViewer,
  186.                                  Handle                 data);
  187.  
  188.  
  189. /******************************************************************************
  190.  **                                                                             **
  191.  **        Use this function to force the Viewer to re-draw                     **
  192.  **                                                                             **
  193.  *****************************************************************************/
  194. EXTERN_API_C( OSErr )
  195. Q3ViewerDraw                    (TQ3ViewerObject         theViewer);
  196.  
  197. EXTERN_API_C( OSErr )
  198. Q3ViewerDrawContent                (TQ3ViewerObject         theViewer);
  199.  
  200. EXTERN_API_C( OSErr )
  201. Q3ViewerDrawControlStrip        (TQ3ViewerObject         theViewer);
  202.  
  203.  
  204. /******************************************************************************
  205.  **                                                                             **
  206.  **        Function used by the Viewer to filter and handle events                 **
  207.  **                                                                             **
  208.  *****************************************************************************/
  209. EXTERN_API_C( Boolean )
  210. Q3ViewerEvent                    (TQ3ViewerObject         theViewer,
  211.                                  EventRecord *            evt);
  212.  
  213.  
  214. /******************************************************************************
  215.  **                                                                             **
  216.  **        This function returns a PICT of the contents of the                  **
  217.  **        Viewer's window.  The application should dispose the PICT.             **
  218.  **                                                                             **
  219.  *****************************************************************************/
  220. EXTERN_API_C( PicHandle )
  221. Q3ViewerGetPict                    (TQ3ViewerObject         theViewer);
  222.  
  223.  
  224. /******************************************************************************
  225.  **                                                                             **
  226.  **                        Calls for dealing with Buttons                         **
  227.  **                                                                             **
  228.  *****************************************************************************/
  229. EXTERN_API_C( OSErr )
  230. Q3ViewerGetButtonRect            (TQ3ViewerObject         theViewer,
  231.                                  unsigned long             button,
  232.                                  Rect *                    rect);
  233.  
  234. EXTERN_API_C( unsigned long )
  235. Q3ViewerGetCurrentButton        (TQ3ViewerObject         theViewer);
  236.  
  237. EXTERN_API_C( OSErr )
  238. Q3ViewerSetCurrentButton        (TQ3ViewerObject         theViewer,
  239.                                  unsigned long             button);
  240.  
  241.  
  242. /******************************************************************************
  243.  **                                                                             **
  244.  **        Functions to set/get the group to be displayed by the Viewer.         **
  245.  **                                                                             **
  246.  *****************************************************************************/
  247. EXTERN_API_C( OSErr )
  248. Q3ViewerUseGroup                (TQ3ViewerObject         theViewer,
  249.                                  TQ3GroupObject         group);
  250.  
  251. EXTERN_API_C( TQ3GroupObject )
  252. Q3ViewerGetGroup                (TQ3ViewerObject         theViewer);
  253.  
  254.  
  255. /******************************************************************************
  256.  **                                                                             **
  257.  **        Functions to set/get the color used to clear the window                 **
  258.  **                                                                             **
  259.  *****************************************************************************/
  260. EXTERN_API_C( OSErr )
  261. Q3ViewerSetBackgroundColor        (TQ3ViewerObject         theViewer,
  262.                                  TQ3ColorARGB *            color);
  263.  
  264. EXTERN_API_C( OSErr )
  265. Q3ViewerGetBackgroundColor        (TQ3ViewerObject         theViewer,
  266.                                  TQ3ColorARGB *            color);
  267.  
  268.  
  269. /******************************************************************************
  270.  **                                                                             **
  271.  **        Getting/Setting a Viewer's View object.                                 **
  272.  **                                                                             **
  273.  *****************************************************************************/
  274. EXTERN_API_C( TQ3ViewObject )
  275. Q3ViewerGetView                    (TQ3ViewerObject         theViewer);
  276.  
  277. EXTERN_API_C( OSErr )
  278. Q3ViewerRestoreView                (TQ3ViewerObject         theViewer);
  279.  
  280.  
  281. /******************************************************************************
  282.  **                                                                             **
  283.  **        Calls for setting/getting viewer flags                                 **
  284.  **                                                                             **
  285.  *****************************************************************************/
  286. EXTERN_API_C( OSErr )
  287. Q3ViewerSetFlags                (TQ3ViewerObject         theViewer,
  288.                                  unsigned long             flags);
  289.  
  290. EXTERN_API_C( unsigned long )
  291. Q3ViewerGetFlags                (TQ3ViewerObject         theViewer);
  292.  
  293.  
  294. /******************************************************************************
  295.  **                                                                             **
  296.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  297.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  298.  **        or the current dimensions of the window (if you do a Set).             **
  299.  **                                                                             **
  300.  *****************************************************************************/
  301. EXTERN_API_C( OSErr )
  302. Q3ViewerSetBounds                (TQ3ViewerObject         theViewer,
  303.                                  Rect *                    bounds);
  304.  
  305. EXTERN_API_C( OSErr )
  306. Q3ViewerGetBounds                (TQ3ViewerObject         theViewer,
  307.                                  Rect *                    bounds);
  308.  
  309. EXTERN_API_C( OSErr )
  310. Q3ViewerSetDimension            (TQ3ViewerObject         theViewer,
  311.                                  unsigned long             width,
  312.                                  unsigned long             height);
  313.  
  314. EXTERN_API_C( OSErr )
  315. Q3ViewerGetDimension            (TQ3ViewerObject         theViewer,
  316.                                  unsigned long *        width,
  317.                                  unsigned long *        height);
  318.  
  319. EXTERN_API_C( OSErr )
  320. Q3ViewerGetMinimumDimension        (TQ3ViewerObject         theViewer,
  321.                                  unsigned long *        width,
  322.                                  unsigned long *        height);
  323.  
  324.  
  325. /******************************************************************************
  326.  **                                                                             **
  327.  **                            Port related calls                                 **
  328.  **                                                                             **
  329.  *****************************************************************************/
  330. EXTERN_API_C( OSErr )
  331. Q3ViewerSetPort                    (TQ3ViewerObject         theViewer,
  332.                                  CGrafPtr                 port);
  333.  
  334. EXTERN_API_C( CGrafPtr )
  335. Q3ViewerGetPort                    (TQ3ViewerObject         theViewer);
  336.  
  337.  
  338. /******************************************************************************
  339.  **                                                                             **
  340.  **        Adjust Cursor should be called from idle loop to allow the Viewer     **
  341.  **        to change the cursor according to the cursor position/object under     **
  342.  **        the cursor.                                                             **
  343.  **                                                                             **
  344.  *****************************************************************************/
  345. EXTERN_API_C( Boolean )
  346. Q3ViewerAdjustCursor            (TQ3ViewerObject         theViewer,
  347.                                  Point *                pt);
  348.  
  349. EXTERN_API_C( OSErr )
  350. Q3ViewerCursorChanged            (TQ3ViewerObject         theViewer);
  351.  
  352.  
  353. /******************************************************************************
  354.  **                                                                             **
  355.  **        Returns the state of the viewer.  See the constant defined at the     **
  356.  **        top of this file.                                                     **
  357.  **                                                                             **
  358.  *****************************************************************************/
  359. EXTERN_API_C( unsigned long )
  360. Q3ViewerGetState                (TQ3ViewerObject         theViewer);
  361.  
  362.  
  363. /******************************************************************************
  364.  **                                                                             **
  365.  **                            Clipboard utilities                                 **
  366.  **                                                                             **
  367.  *****************************************************************************/
  368. EXTERN_API_C( OSErr )
  369. Q3ViewerClear                    (TQ3ViewerObject         theViewer);
  370.  
  371. EXTERN_API_C( OSErr )
  372. Q3ViewerCut                        (TQ3ViewerObject         theViewer);
  373.  
  374. EXTERN_API_C( OSErr )
  375. Q3ViewerCopy                    (TQ3ViewerObject         theViewer);
  376.  
  377. EXTERN_API_C( OSErr )
  378. Q3ViewerPaste                    (TQ3ViewerObject         theViewer);
  379.  
  380.  
  381. /******************************************************************************
  382.  **                                                                             **
  383.  **                            New Event Model                                     **
  384.  **                                                                             **
  385.  *****************************************************************************/
  386. EXTERN_API_C( Boolean )
  387. Q3ViewerMouseDown                (TQ3ViewerObject         theViewer,
  388.                                  long                     x,
  389.                                  long                     y);
  390.  
  391. EXTERN_API_C( Boolean )
  392. Q3ViewerContinueTracking        (TQ3ViewerObject         theViewer,
  393.                                  long                     x,
  394.                                  long                     y);
  395.  
  396. EXTERN_API_C( Boolean )
  397. Q3ViewerMouseUp                    (TQ3ViewerObject         theViewer,
  398.                                  long                     x,
  399.                                  long                     y);
  400.  
  401. EXTERN_API_C( Boolean )
  402. Q3ViewerHandleKeyEvent            (TQ3ViewerObject         theViewer,
  403.                                  EventRecord *            evt);
  404.  
  405.  
  406. /******************************************************************************
  407.  **                                                                             **
  408.  **                                    CallBacks                                 **
  409.  **                                                                             **
  410.  *****************************************************************************/
  411. EXTERN_API_C( OSErr )
  412. Q3ViewerSetDrawingCallbackMethod (TQ3ViewerObject         theViewer,
  413.                                  TQ3ViewerDrawingCallbackMethod  callbackMethod,
  414.                                  const void *            data);
  415.  
  416. EXTERN_API_C( OSErr )
  417. Q3ViewerSetWindowResizeCallback    (TQ3ViewerObject         theViewer,
  418.                                  TQ3ViewerWindowResizeCallbackMethod  windowResizeCallbackMethod,
  419.                                  const void *            data);
  420.  
  421. EXTERN_API_C( OSErr )
  422. Q3ViewerSetPaneResizeNotifyCallback (TQ3ViewerObject     theViewer,
  423.                                  TQ3ViewerPaneResizeNotifyCallbackMethod  paneResizeNotifyCallbackMethod,
  424.                                  const void *            data);
  425.  
  426.  
  427. /******************************************************************************
  428.  **                                                                             **
  429.  **                                    Undo                                     **
  430.  **                                                                             **
  431.  *****************************************************************************/
  432. EXTERN_API_C( OSErr )
  433. Q3ViewerUndo                    (TQ3ViewerObject         theViewer);
  434.  
  435. EXTERN_API_C( Boolean )
  436. Q3ViewerGetUndoString            (TQ3ViewerObject         theViewer,
  437.                                  char *                    str,
  438.                                  unsigned long *        cnt);
  439.  
  440.  
  441. /******************************************************************************
  442.  **                                                                             **
  443.  **                                Camera Support                                 **
  444.  **                                                                             **
  445.  *****************************************************************************/
  446. EXTERN_API_C( OSErr )
  447. Q3ViewerGetCameraCount            (TQ3ViewerObject         theViewer,
  448.                                  unsigned long *        cnt);
  449.  
  450. EXTERN_API_C( OSErr )
  451. Q3ViewerSetCameraByNumber        (TQ3ViewerObject         theViewer,
  452.                                  unsigned long             cameraNo);
  453.  
  454. EXTERN_API_C( OSErr )
  455. Q3ViewerSetCameraByView            (TQ3ViewerObject         theViewer,
  456.                                  TQ3ViewerCameraView     viewType);
  457.  
  458.  
  459. /******************************************************************************
  460.  **                                                                             **
  461.  **                            Pop-up Button Options                             **
  462.  **                                                                             **
  463.  *****************************************************************************/
  464. EXTERN_API_C( OSErr )
  465. Q3ViewerSetRendererType            (TQ3ViewerObject         theViewer,
  466.                                  TQ3ObjectType             rendererType);
  467.  
  468. EXTERN_API_C( OSErr )
  469. Q3ViewerGetRendererType            (TQ3ViewerObject         theViewer,
  470.                                  TQ3ObjectType *        rendererType);
  471.  
  472. EXTERN_API_C( OSErr )
  473. Q3ViewerChangeBrightness        (TQ3ViewerObject         theViewer,
  474.                                  float                     brightness);
  475.  
  476. EXTERN_API_C( OSErr )
  477. Q3ViewerSetRemoveBackfaces        (TQ3ViewerObject         theViewer,
  478.                                  TQ3Boolean             remove);
  479.  
  480. EXTERN_API_C( OSErr )
  481. Q3ViewerGetRemoveBackfaces        (TQ3ViewerObject         theViewer,
  482.                                  TQ3Boolean *            remove);
  483.  
  484. EXTERN_API_C( OSErr )
  485. Q3ViewerSetPhongShading            (TQ3ViewerObject         theViewer,
  486.                                  TQ3Boolean             phong);
  487.  
  488. EXTERN_API_C( OSErr )
  489. Q3ViewerGetPhongShading            (TQ3ViewerObject         theViewer,
  490.                                  TQ3Boolean *            phong);
  491.  
  492.  
  493. #endif  /* TARGET_OS_MAC */
  494.  
  495.  
  496.  
  497.  
  498.  
  499. #if PRAGMA_ENUM_ALWAYSINT
  500.     #pragma enumsalwaysint reset
  501. #elif PRAGMA_ENUM_OPTIONS
  502.     #pragma option enum=reset
  503. #elif defined(PRAGMA_ENUM_PACK__QD3DVIEWER__)
  504.     #pragma options(pack_enums)
  505. #endif
  506.  
  507. #if PRAGMA_STRUCT_ALIGN
  508.     #pragma options align=reset
  509. #elif PRAGMA_STRUCT_PACKPUSH
  510.     #pragma pack(pop)
  511. #elif PRAGMA_STRUCT_PACK
  512.     #pragma pack()
  513. #endif
  514.  
  515. #ifdef PRAGMA_IMPORT_OFF
  516. #pragma import off
  517. #elif PRAGMA_IMPORT
  518. #pragma import reset
  519. #endif
  520.  
  521. #ifdef __cplusplus
  522. }
  523. #endif
  524.  
  525. #endif /* __QD3DVIEWER__ */
  526.  
  527.